﻿@using System.Data;
@using System.Web;
@using DTcms.Web.MVC.Areas.Web.Controllers;
@using DTcms.Web.MVC.UI.Controllers;
@using DTcms.Model;
@{
   DTcms.Model.sites site = ViewData["site"] as DTcms.Model.sites;
   DTcms.Model.sysconfig config = ViewData["sysConfig"] as DTcms.Model.sysconfig;
   Layout = "~/Areas/Web/Views/" + site.build_path + "/Shared/_Layout.cshtml";
   ArticleController bc = ViewBag.This as ArticleController;
   ViewBag.Title = "购物商城 - " + site.name;
   string channel = "goods";
}

<!--当前位置-->
<div class="section">
  <div class="location">
    <span>当前位置：</span>
    <a href="@bc.linkurl("index")">首页</a> &gt;
        <a href="@bc.linkurl("goods")">购物商城</a>
  </div>
</div>
<!--/当前位置-->

<!--导航推荐-->
<div class="section">
  <div class="wrapper">
    <div class="wrap-box">
      <!--类别菜单-->
      <div class="left-220" style="margin: 0;">
        <div class="banner-nav">
          <ul>
            <!--此处声明下面可重复循环-->
            @{DataTable categoryList = bc.get_category_child_list(channel, 0);}
            @foreach (DataRow cdr in categoryList.Rows) {
              DataTable bcategoryList = bc.get_category_child_list(channel, Convert.ToInt32(cdr["id"]));
              <li>
                <h3>
                  <i class="iconfont icon-arrow-right"></i>
                  <span>@cdr["title"]</span>
                  <p>
                    @foreach (DataRow dr in bcategoryList.Rows) {
                      @dr["title"]
                    }
                  </p>
                </h3>
                <div class="item-box">
                  <!--如有三级分类，此处可循环-->
                  <dl>
                    <dt><a href="@bc.linkurl("goods_list", cdr["id"])">@cdr["title"]</a></dt>
                    <dd>
                      @foreach (DataRow dr in bcategoryList.Rows) {
                        <a href="@bc.linkurl("goods_list", dr["id"])">@dr["title"]</a>
                      }
                    </dd>
                  </dl>
                </div>
              </li>
            }
          </ul>
        </div>
      </div>
      <!--/类别菜单-->

      <!--幻灯片-->
      <div class="left-705">
        <div class="banner-img">
          <div id="focus-box" class="focus-box">
            <ul class="slides">
              <li>
                <a href="@bc.linkurl("goods")">
                  <img src="~/templates/@site.templet_path/images/focus_1.png" />
                </a>
              </li>
              <li>
                <a href="@bc.linkurl("goods")">
                  <img src="~/templates/@site.templet_path/images/focus_2.png" />
                </a>
              </li>
            </ul>
          </div>
        </div>
      </div>
      <!--/幻灯片-->

      <!--推荐商品-->
      <div class="left-220">
        <ul class="side-img-list">
          @{DataTable redList = bc.get_article_list(channel, 0, 4, "status=0 and is_red=1");}
          @for (int i = 0; i < redList.Rows.Count; i++) {
            DataRow reddr = redList.Rows[i];
            <li>
              <div class="img-box">
                <label>@(i + 1)</label>
                <img src="@reddr["img_url"]" />
              </div>
              <div class="txt-box">
                <a href="@bc.linkurl("goods_show", reddr["id"])">@reddr["title"]</a>
                <span>@DateTime.Parse(reddr["add_time"].ToString()).ToString("yyyy-MM-dd")</span>
              </div>
            </li>
          }
        </ul>
      </div>
      <!--/推荐商品-->
    </div>
  </div>
</div>
<!--分类推荐-->
<div class="section">
  @foreach (DataRow cdr in categoryList.Rows) {
    <!--子类-->
    <div class="main-tit">
      <h2>@cdr["title"]</h2>
      <p>
        @{DataTable bcategoryList = bc.get_category_child_list(channel, Convert.ToInt32(cdr["id"]));}
        @foreach (DataRow dr in bcategoryList.Rows) {
          <a href="@bc.linkurl("goods_list", dr["id"])">@dr["title"]</a>
        }
        <a href="@bc.linkurl("goods_list", cdr["id"])">更多<i>+</i></a>
      </p>
    </div>
    <!--/子类-->
    <div class="wrapper clearfix">
      <div class="wrap-box">
        <ul class="img-list">
          @{DataTable dt = bc.get_article_list(channel, Convert.ToInt32(cdr["id"]), 5, "status=0");}
          @foreach (DataRow dr in dt.Rows) {
            <li>
              <a href="@bc.linkurl("goods_show", @dr["id"])">
                <div class="img-box">
                  <img src="@dr["img_url"]" /></div>
                <div class="info">
                  <h3>@dr["title"]</h3>
                  <p class="price"><b>¥@dr["sell_price"]</b>元</p>
                  <p>
                    <strong>库存 @dr["stock_quantity"]</strong>
                    <span>市场价：<s>@dr["market_price"]</s></span>
                  </p>
                </div>
              </a>
            </li>
          }
        </ul>
      </div>
    </div>
  }
</div>
<!--/分类推荐-->
